FROM node:18-alpine

USER root

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories

RUN apk update && apk upgrade
RUN apk add --no-cache curl npm make gcc g++ python3 linux-headers

WORKDIR /app

RUN npm config set registry https://registry.npmmirror.com

COPY . .

RUN npm cache clean --force

RUN npm install

EXPOSE 3000

CMD ["node", "--experimental-specifier-resolution=node", "dist/src/serve.js"]